package com.cinyi.ormx.android.context;

import java.util.Properties;

import android.app.Application;

import com.cinyi.ormx.android.dao.DefaultSQLiteHelper;

public abstract class OrmxContext extends Application {
	
	public static final int PAGE_SIZE = 20;
	
	public boolean m_bKeyRight = true;
	
	private static AppConfig appConfig = null ;
	
	@Override
	public void onCreate() {
		super.onCreate();
		
		appConfig = AppConfig.getAppConfig(this);
		
        //注册App异常崩溃处理器
        Thread.setDefaultUncaughtExceptionHandler(AppException.getAppExceptionHandler());
        
	}

	public boolean containsProperty(String key){
		Properties props = getProperties();
		 return props.containsKey(key);
	}
	
	public void setProperties(Properties ps){
		appConfig.set(ps);
	}

	public Properties getProperties(){
		return appConfig.get();
	}
	
	public static void setProperty(String key,String value){
		appConfig.set(key, value);
	}
	
	public static String getProperty(String key){
		return appConfig.get(key);
	}
	public void removeProperty(String...key){
		appConfig.remove(key);
	}
	
	public abstract DefaultSQLiteHelper getSQLiteHelper() ;

	public static AppConfig getAppConfig() {
		return appConfig;
	}

}
